home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / INESWIN.ZIP / NES.DOC < prev    next >
Text File  |  1996-09-14  |  25KB  |  549 lines

  1.  
  2.                Nintendo Entertainment System Architecture
  3.                         version 1.4 [09/09/1996]
  4.  
  5.                  by Marat Fayzullin [fms@freeflight.com]
  6.                    WWW: http://www.freeflight.com/fms/
  7.                                IRC: RST38h
  8.  
  9.  
  10.   The following document describes the workings of Nintendo Entertainment
  11. System videogame console, also known as Famicom in the East (Korea, Japan),
  12. and Dandy in Europe (Russia, etc.). Note that this document is in no way
  13. based on any official Nintendo information and may be incomplete and
  14. incorrect in many places. "Nintendo Entertainment System" and "Famicom" are
  15. registered trademarks of Nintendo.
  16.  
  17.   I would like to thank following people for their help in obtaining this
  18. information and writing a NES emulator, as well as the moral support from
  19. some of them:
  20.  
  21.   (sorted alphabetically)
  22.   Pascal Felber     Pan of Anthrox       John Stiles
  23.   Kawasedo          Patrick Lesaard      Tink
  24.   Marcel de Kogel   Paul Robson          Bas Vijfwinkel
  25.   Alex Krasivsky    Serge Skorobogatov
  26.  
  27.   The current version of this file is missing some information, such as
  28. sound hardware. I will add these parts in later releases. If you have any
  29. information on NES, which is not in this manual, feel free to write to
  30. fms@freeflight.com. Your help will be appreciated. 
  31.  
  32.  
  33. ******************************* Contents *******************************
  34.  
  35.   1. General Architecture
  36.   2. Interrupts
  37.   3. I/O Ports
  38.   4. PPU Memory
  39.   5. Hit/VBlank Bits
  40.   6. Joysticks
  41.   7. Sprites
  42.   8. Memory Mappers
  43.      a) Sequential
  44.      b) Konami
  45.      c) VROM Switch
  46.      d) 5202 Chip
  47.      e) Others
  48.   9. Sound (to be written)
  49.  
  50.  
  51. ************************* General Architecture *************************
  52.  
  53.   NES is based on the 6502 CPU, and a custom video controller known as PPU
  54. (Picture Processing Unit). The PPU's video memory is separated from the
  55. main CPU memory and can be read/written via special ports. Cartridges may
  56. contain both ROM appearing in the main CPU address space at $8000-$FFFF,
  57. and VROM or VRAM appearing in the PPU address space at $0000-$1FFF and
  58. containing the Pattern Tables (aka Tile Tables). In smaller cartridges,
  59. which only have 16kB ROM, it takes place at $C000-$FFFF leaving $8000-$BFFF
  60. area unused. Internal NES VRAM is located at addresses $2000-$3FFF in the 
  61. PPU memory. Some cartridges also have RAM at $6000-$7FFF, which may or may
  62. not be battery-backed. 
  63.  
  64. CPU Memory Map
  65. --------------------------------------- $10000
  66.  Upper Bank of Cartridge ROM
  67. --------------------------------------- $C000
  68.  Lower Bank of Cartridge ROM
  69. --------------------------------------- $8000
  70.  Cartridge RAM (may be battery-backed)
  71. --------------------------------------- $6000
  72.  Expansion Modules
  73. --------------------------------------- $5000
  74.  Input/Output
  75. --------------------------------------- $2000
  76.  2kB Internal RAM, mirrored 4 times
  77. --------------------------------------- $0000
  78.  
  79.  
  80. ****************************** Interrupts ******************************
  81.  
  82.   NES uses non-maskable interrupts (NMIs) generated by PPU in the end of
  83. each frame (so-called VBlank interrupts). Maskable interrupts, or IRQs,
  84. can also be generated by circuitry in a cart, but most carts do not
  85. generate them. The VBlank interrupts can be enabled/disabled by writing
  86. 1/0 into 7th bit of $2000. When a VBlank interrupts occur, CPU pushes
  87. return address and the status register on stack, and jumps to the address
  88. stored at location $FFFA (ROM in NES). The interrupt handler is supposed
  89. to finish its execution with RTI command which returns CPU to the main
  90. program execution. More information on the interrupt handling can be found
  91. in a decent book on 6502 CPU. 
  92.  
  93.  
  94. ****************************** I/O ports *******************************
  95.  
  96.    NES internal I/O ports are mapped into the areas of $2000-$2007 and 
  97. $4000-$4017. Some ports' usage is unknown or unclear, and any information
  98. is appreciated.
  99.  
  100. I/O Ports Map
  101. ------+-----+---------------------------------------------------------------
  102. $2000 | RW  | PPU Control Register 1
  103.       | 0-1 | Name Table to show:
  104.       |     |
  105.       |     |           +-----------+-----------+
  106.       |     |           | 2 ($2800) | 3 ($2C00) |
  107.       |     |           +-----------+-----------+
  108.       |     |           | 0 ($2000) | 1 ($2400) |
  109.       |     |           +-----------+-----------+
  110.       |     |
  111.       |     | Remember, though, that because of the mirroring, there are  
  112.       |     | only 2 real Name Tables, not 4.
  113.       |   2 | Vertical Write, 1 = PPU memory address increments by 32:
  114.       |     |
  115.       |     |    Name Table, VW=0          Name Table, VW=1
  116.       |     |   +----------------+        +----------------+
  117.       |     |   |----> write     |        | | write        |
  118.       |     |   |                |        | V              |
  119.       |     |
  120.       |   3 | Sprite Pattern Table address, 1 = $1000, 0 = $0000
  121.       |   4 | Screen Pattern Table address, 1 = $1000, 0 = $0000
  122.       |   5 | Sprite Size, 1 = 8x16, 0 = 8x8
  123.       |   6 | Hit Switch, 1 = generate interrupts on Hit (incorrect ???)
  124.       |   7 | VBlank Switch, 1 = generate interrupts on VBlank
  125. ------+-----+---------------------------------------------------------------
  126. $2001 | RW  | PPU Control Register 2
  127.       |   0 | Unknown (???)
  128.       |   1 | Image Mask, 0 = don't show left 8 columns of the screen
  129.       |   2 | Sprite Mask, 0 = don't show sprites in left 8 columns 
  130.       |   3 | Screen Switch, 1 = show picture, 0 = blank screen
  131.       |   4 | Sprites Switch, 1 = show sprites, 0 = hide sprites
  132.       | 5-7 | Unknown (???)
  133. ------+-----+---------------------------------------------------------------
  134. $2002 | R   | PPU Status Register
  135.       | 0-5 | Unknown (???)
  136.       |   6 | Hit Flag, 1 = PPU refresh has hit sprite #0
  137.       |     | This flag resets to 0 when VBlank starts, or CPU reads $2002
  138.       |     | (see "Hit/VBlank Bits").
  139.       |   7 | VBlank Flag, 1 = PPU is generating a Vertical Blanking Impulse
  140.       |     | This flag resets to 0 when VBlank ends, or CPU reads $2002
  141.       |     | (see "Hit/VBlank Bits").
  142. ------+-----+---------------------------------------------------------------
  143. $2003 | W   | Sprite Memory Address
  144.       |     | Used to set the address in the 256-byte Sprite Memory to be 
  145.       |     | accessed via $2004. This address will increment by 1 after
  146.       |     | each access to $2004. The Sprite Memory contains coordinates,
  147.       |     | colors, and other attributes of the sprites (see "Sprites").
  148. ------+-----+---------------------------------------------------------------
  149. $2004 | RW  | Sprite Memory Data
  150.       |     | Used to read/write the Sprite Memory. The address is set via
  151.       |     | $2003 and increments after each access. The Sprite Memory 
  152.       |     | contains coordinates, colors, and other attributes of the 
  153.       |     | sprites (see "Sprites").
  154. ------+-----+---------------------------------------------------------------
  155. $2005 | W   | Background Scroll
  156.       |     | There are two scroll registers, vertical and horizontal, 
  157.       |     | which are both written via this port. The first value written
  158.       |     | will go into the Vertical Scroll Register (unless it is >239,
  159.       |     | then it will be ignored). The second value will appear in the
  160.       |     | Horizontal Scroll Register. The Name Tables are assumed to be
  161.       |     | arranged in the following way:
  162.       |     |
  163.       |     |           +-----------+-----------+
  164.       |     |           | 2 ($2800) | 3 ($2C00) |
  165.       |     |           +-----------+-----------+
  166.       |     |           | 0 ($2000) | 1 ($2400) |
  167.       |     |           +-----------+-----------+
  168.       |     |
  169.       |     | When scrolled, the picture may span over several Name Tables.
  170.       |     | Remember, though, that because of the mirroring, there are
  171.       |     | only 2 real Name Tables, not 4.
  172. ------+-----+---------------------------------------------------------------
  173. $2006 |     | PPU Memory Address
  174.       |     | See "PPU Memory".
  175. ------+-----+---------------------------------------------------------------
  176. $2007 |     | PPU Memory Data
  177.       |     | See "PPU Memory".
  178. ------+-----+---------------------------------------------------------------
  179. $4000-$4013 | Sound Registers
  180.             | See "Sound".
  181. ------+-----+---------------------------------------------------------------
  182. $4014 | W   | DMA Access to the Sprite Memory
  183.       |     | Writing a value N into this port, causes an area of CPU memory
  184.       |     | at address $100*N to be transferred into the Sprite Memory.
  185. ------+-----+---------------------------------------------------------------
  186. $4015 | W   | Sound Switch
  187.       |   0 | Channel 1, 1 = enable sound
  188.       |   1 | Channel 2, 1 = enable sound
  189.       |   2 | Channel 3, 1 = enable sound
  190.       |   3 | Channel 4, 1 = enable sound
  191.       |   4 | Channel 5, 1 = enable sound
  192.       | 5-7 | Unused (???)
  193. ------+-----+---------------------------------------------------------------
  194. $4016 | RW  | Joystick 1 + Strobe
  195.       |   0 | Joystick 1 data
  196.       |   1 | Joystick 1 presence, 0 = connected
  197.       | 2-5 | Unused, set to 0 (???)
  198.       | 6-7 | Unknown, set to 10 (???)
  199.       |     | See "Joysticks".
  200. ------+-----+---------------------------------------------------------------
  201. $4017 | R   | Joystick 2
  202.       |   0 | Joystick 2 data
  203.       |   1 | Joystick 2 presence, 0 = connected
  204.       | 2-5 | Unused, set to 0 (???)
  205.       | 6-7 | Unknown, set to 10 (???)
  206.       |     | See "Joysticks".
  207. ------+-----+---------------------------------------------------------------
  208.  
  209.  
  210. ****************************** PPU Memory ******************************
  211.  
  212.   In a real NES, reading/writing PPU memory should only be attempted
  213. during VBlank period. Many smaller ROMs have read-only memory (VROM) for
  214. the Pattern Tables. In this case, you won't be able to write into this
  215. memory. The $3F00 and $3F10 locations in VRAM mirror each other (i.e. it
  216. is the same memory cell) and define the background color of the picture. 
  217.  
  218.    Writing to PPU memory:
  219.    a) Write upper address byte into $2006
  220.    b) Write lower address byte into $2006
  221.    c) Write data into $2007. After each write, the address will
  222.       increment either by 1 (bit 2 of $2000 is 0) or by 32 (bit 2 of
  223.       $2000 is 1).
  224.  
  225.    Reading from PPU memory:
  226.    a) Write upper address byte into $2006
  227.    b) Write lower address byte into $2006
  228.    c) Read data from $2007. The first byte read from $2007 will be
  229.       invalid. Then, the address will increment by 1 after each
  230.       read.
  231.  
  232.   Name Table contains tile numbers organized into 32 rows of 32 bytes
  233. each. Tiles are 8x8 pixels each. Therefore, the whole Name Table is 32x32
  234. tiles or 256x256 pixels. In the NTSC version of NES, upper and lower 16
  235. pixels are not shown, thus, the screen becomes 256x224 pixels. In the PAL
  236. version of NES, upper and lower 8 pixels are not show, thus, the screen
  237. becomes 256x240 pixels.
  238.  
  239.   Pattern Table contains tile images in the following format:
  240.  
  241.   Character   Colors      Contents of Pattern Table
  242.   ...o....    00010000    00010000 $10  +-> 00000000 $00
  243.   ..O.O...    00202000    00000000 $00  |   00101000 $28
  244.   .0...0..    03000300    01000100 $44  |   01000100 $44
  245.   O.....O.    20000020    00000000 $00  |   10000010 $82
  246.   ooooooo. -> 11111110    11111110 $FE  |   00000000 $00
  247.   O.....O.    20000020    00000000 $00  |   10000010 $82
  248.   0.....0.    30000030    10000010 $82  |   10000010 $82
  249.   ........    00000000    00000000 $00  |   00000000 $00
  250.                               +---------+
  251.  
  252.   Note that only two bits for each pixel of a character are stored in the
  253. Pattern Table. Other two are taken from the Attribute Table. Thus, the total
  254. number of simultaneous colors on the NES screen is 16.
  255.  
  256.   Each byte in the Attribute Table represents a 4x4 group of tiles on the 
  257. screen, which makes an 8x8 attribute table. Each 4x4 tile group is
  258. subdivided into four 2x2 squares as follows:
  259.  
  260.    (0,0)  (1,0) 0|  (2,0)  (3,0) 1
  261.    (0,1)  (1,1)  |  (2,1)  (3,1)
  262.    --------------+----------------
  263.    (0,2)  (1,2) 2|  (2,2)  (3,2) 3
  264.    (0,3)  (1,3)  |  (2,3)  (3,3)
  265.  
  266.   The attribute byte contains upper two bits of the color number for each
  267. 2x2 square (the lower two bits are stored in the Pattern Table): 
  268.  
  269.   Bits   Function                        Tiles
  270.   --------------------------------------------------------------
  271.   7,6    Upper color bits for square 3   (2,2),(3,2),(2,3),(3,3)    
  272.   5,4    Upper color bits for square 2   (0,2),(1,2),(0,3),(1,3)
  273.   3,2    Upper color bits for square 1   (2,0),(3,0),(2,1),(3,1)
  274.   1,0    Upper color bits for square 0   (0,0),(1,0),(0,1),(1,1)
  275.    
  276.   There are two 16-byte Palette Tables: the one at $3F00, used for the
  277. picture, and another one at $3F10, containing the sprite palette. The
  278. $3F00 and $3F10 locations in VRAM mirror each other (i.e. it is the same
  279. memory cell) and define the background color of the picture. 
  280.  
  281.   There is only enough VRAM for 2 Name Tables and Attribute Tables. Two
  282. others are going to be mirrors of the first two, i.e. exact copies of them.
  283. Which pages are mirrored depends on the cartridge circuitry. With vertical
  284. mirroring, tables 2 and 3 are the mirrors of pages 0 and 1 appropriately.
  285. With horizontal mirroring, pages 1 and 3 are the mirrors of pages 0 and 2
  286. appropriately.
  287.  
  288. PPU Memory Map
  289. --------------------------------------- $4000
  290.  Empty
  291. --------------------------------------- $3F20
  292.  Sprite Palette
  293. --------------------------------------- $3F10
  294.  Image Palette
  295. --------------------------------------- $3F00
  296.  Empty
  297. --------------------------------------- $3000
  298.  Attribute Table 3
  299. --------------------------------------- $2FC0
  300.  Name Table 3 (32x25 tiles)
  301. --------------------------------------- $2C00
  302.  Attribute Table 2
  303. --------------------------------------- $2BC0
  304.  Name Table 2 (32x25 tiles)
  305. --------------------------------------- $2800
  306.  Attribute Table 1
  307. --------------------------------------- $27C0
  308.  Name Table 1 (32x25 tiles)
  309. --------------------------------------- $2400
  310.  Attribute Table 0
  311. --------------------------------------- $23C0
  312.  Name Table 0 (32x25 tiles)
  313. --------------------------------------- $2000
  314.  Pattern Table 1 (256x2x8, may be VROM)
  315. --------------------------------------- $1000
  316.  Pattern Table 0 (256x2x8, may be VROM)
  317. --------------------------------------- $0000
  318.  
  319.  
  320. *************************** Hit/VBlank Bits ****************************
  321.  
  322.    The VBlank flag is contained in the 7th bit of read-only location $2002. 
  323. It indicates whether PPU is scanning the screen, or generating a vertical
  324. blanking impulse. It is set in the end of each frame (scanline 232), and
  325. stays on until the next screen refresh starts from the scanline 8. The
  326. program can reset this bit prematurely by reading from $2002.
  327.  
  328.    The Hit flag is contained in the 6th bit of read-only location $2002. 
  329. It goes to 1 when PPU starts refreshing the first scanline where sprite#0
  330. is located. For example, if sprite#0's Y coordinate is 34, the Hit flag
  331. will be set in scanline 34. The Hit flag is reset when vertical blanking
  332. impulse starts. The program can reset this bit prematurely by reading from
  333. $2002. 
  334.  
  335.  
  336. ******************************* Joysticks ******************************
  337.  
  338.   There are two joysticks which are accessed via locations $4016 and
  339. $4017. To reset joysticks, write first 1, then 0 into $4016. This way, you
  340. will generate a strobe in the joysticks' circuitry. Then, read either from
  341. $4016 (for joystick 0) or from $4017 (for joystick 1).  Each read will
  342. give you the status of a single button in the 0th bit (1 if pressed, 0
  343. otherwise): 
  344.  
  345. Read # |    1      2      3      4      5      6      7      8
  346. -------+---------------------------------------------------------
  347. Button |    A      B   SELECT   START   UP    DOWN   LEFT  RIGHT
  348.  
  349.   Bit 1 indicates whether joystick is connected to the port or not. It is
  350. set to 0 if the joystick is connected, 1 otherwise. Bits 6 and 7 of
  351. $4016/$4017 also seem to have some significance, which is not clear yet.
  352. The rest of bits is set to zeroes. Some games expect to get *exactly* $41
  353. from $4016/$4017, if a button is pressed, which has to be taken into
  354. account. 
  355.  
  356.  
  357. ******************************* Sprites ********************************
  358.  
  359.   There are 64 sprites, which can be either 8x8 or 8x16 pixels. Sprites
  360. patterns are stored in on of the Pattern Tables in the PPU Memory. Sprite
  361. attributes are stored in the Sprite Memory of 256 bytes, which is not a
  362. part of neither CPU nor PPU address space. The entire contents of Sprite
  363. Memory can be written via DMA transfer using location $4014 (see above).
  364. Sprite Memory can also be accessed byte-by-byte by putting the starting
  365. address into $2003 and then writing/reading $2004 (the address will be
  366. incremented after each access). The format of sprite attributes is as
  367. follows: 
  368.  
  369. Sprite Attribute RAM:
  370. | Sprite#0 | Sprite#1 | ... | Sprite#62 | Sprite#63 |
  371.      |          |
  372.      +---- 4 bytes: 0: Y position of the left-top corner - 1
  373.                     1: Sprite pattern number
  374.                     2: Color and attributes:
  375.                        bits 1,0: two upper bits of color
  376.                        bits 2,3,4: Unknown (???)
  377.                        bit 5: if 1, display sprite behind background
  378.                        bit 6: if 1, flip sprite horizontally
  379.                        bit 7: if 1, flip sprite vertically
  380.                     3: X position of the left-top corner
  381.  
  382. Sprite patterns are fetched in the exactly same way as the tile patterns
  383. for the background picture. The only difference occurs in the 16x8
  384. sprites: the top half of the sprite is taken from the Sprite Pattern Table
  385. set in the $2000 port, while the bottom part is taken from the same
  386. location of the alternative Pattern Table. Therefore, if PPU is displaying
  387. a 16x8 sprite, and the Sprite Pattern Table is set to $1000, the bottom
  388. half of this sprite will be taken out of the $0000 Pattern Table, and vice
  389. versa. 
  390.  
  391.  
  392. **************************** Memory Mappers ****************************
  393.  
  394.   There are many diffirent memory mappers (aka MMCs) used in the NES 
  395. cartridges. They are used to switch ROM and VROM pages, and do some other 
  396. tasks. I will only describe the MMCs I'm familiar with. Any new 
  397. information on these and other MMCs is highly appreciated. The MMC 
  398. numbers are given in terms of the .NES file field "Mapper Type".
  399.  
  400.  
  401. 1.  Mapper #1, Sequential
  402.  
  403.   This is a sequential mapper used in many 256kB cartridges, such as
  404. Bomberman 2, Destiny Of The Emperor, Megaman 2, Airwolf, Operation Wolf,
  405. Castlevania 2, Silk Worm, Yoshi, Break Thru. It may be used to switch ROM
  406. and VROM. If there is no VROM, 8kB of VRAM is present at $0000. In some
  407. cases (mostly RPG games) such cartridges also contain battery-backed RAM
  408. at $6000-$7FFF. The mapper has four 5bit registers, which are accessed via
  409. following addresses: 
  410.  
  411. Register  Address Range  Function
  412. ---------------------------------------------------------------------------
  413. 0         $8000-$9FFF    Mirroring and VROM Page Size select
  414.           The 0th bit of this register selects the mirroring type (1 for
  415.           horizontal, 0 for vertical). The 4th bit selects the size of
  416.           VROM pages. When it is 1, two 4kB VROM pages can be switched
  417.           independently at $0000 and $1000. Otherwise, there is a single
  418.           8kB VROM page at $0000.
  419.  
  420. 1         $A000-$BFFF    VROM page select
  421.           This register sets either 8kB or 4kB VROM page at $0000,
  422.           depending on the page size selected via register 0.
  423.  
  424. 2         $C000-$DFFF    Second VROM page select for 4kB pages
  425.           If 4kB VROM pages selected via register 0, this register sets
  426.           the VROM page at $1000. Otherwise, its value is ignored.
  427.  
  428. 3         $E000-$FFFF    ROM page select
  429.           This register sets 16kB ROM page at $8000. The page at $C000 is 
  430.           always hardwired to the last ROM page in the cartridge. The 
  431.           cartridge starts with page 0 at $8000.
  432. ---------------------------------------------------------------------------
  433.  
  434.   In order to write to a mapper register, write $80 into any of the
  435. locations first. This will reset the mapper. Then write the value bit by
  436. bit into an appropriate address range. For example, the following assembly
  437. code will write $0C into register 3: 
  438.  
  439.      lda  #$80     ; Resetting mapper
  440.      sta  $8000    ;
  441.      lda  #$0C     ; This is our value
  442.      sta  $EFD9    ; Writing bit 0
  443.      lsr  a        ; Shifting
  444.      sta  $EFD9    ; Writing bit 1
  445.      lsr  a        ; Shifting
  446.      sta  $EFD9    ; Writing bit 2
  447.      lsr  a        ; Shifting
  448.      sta  $EFD9    ; Writing bit 3
  449.      lsr  a        ; Shifting
  450.      sta  $EFD9    ; Writing bit 4
  451.  
  452.  
  453. 2. Mapper #2, Konami
  454.  
  455.   This is a quite simple mapper used in most Konami (Life Force,
  456. Castlevania, Metal Gear) and some other cartridges. It only switches the
  457. ROM. All cartridges with this mapper have 8kB VRAM at $0000 (i.e. no
  458. VROM). The mapper has a single 8bit register which can be written via
  459. locations $8000-$FFFF. It contains a number of 16kB ROM page at $8000. 
  460. The page at $C000 is always hardwired to the last ROM page in the
  461. cartridge. The cartridge starts with page 0 at $8000.
  462.  
  463.   There is one more thing to note about this mapper: although any address
  464. in the $8000-$FFFF range can be used to access the mapper, most games
  465. prefer to use the address with the last digit equal to the value they
  466. write out. Thus, $07 can be written to $9FF7, $05 to $9FF5, and so forth.
  467. The reason for this is unknown. 
  468.  
  469.  
  470. 3. Mapper #3, VROM Switch
  471.  
  472.   Mapper #3, also known as a VROM switch, is used in the Goonies series
  473. and many Japanese-only games. It only allows you to switch 8kB pages of
  474. VROM. The ROM is either 16kB or 32kB and is not paged. The mapper has a
  475. single 8bit register which can be written via locations $8000-$FFFF. It
  476. contains a number of 8kB VROM page at $0000. 
  477.  
  478.   As with mapper #2, many games use locations with the last digit equal to
  479. the value being written. I do not know why. 
  480.  
  481.  
  482. 4. Mapper #4, 5202 Chip (???)
  483.  
  484.   This mapper (or should I say 'an expansion chip'?) is used in many
  485. recent cartridges, such as Batman Returns, Super Contra, Vindicators,
  486. Silver Surfer, etc. It is an extremely complicated device, which is able
  487. to generate its own interrupts via IRQ line, and has a set of commands to
  488. switch ROM and VROM. VROM pages are 1kB, ROM pages appear to be 8kB. I do
  489. not completely understand how this mapper works, so any information is
  490. appreciated. 
  491.  
  492.   The chip is controlled via following locations:
  493.  
  494. Address  Function
  495. ---------------------------------------------------------------------------
  496. $8000    A command number (0-7) is written here. Also, write to this 
  497.          register appears to reset the change made by a write into $E000.
  498. $8001    An value for command is written here.
  499. $A000    The 0th bit controls mirroring (1 = horizontal mirroring).
  500. $A001    Same as $8001 (???)
  501. $C000    Unknown
  502. $C001    Unknown
  503. $E000    The 5th bit appears to swap memory at $8000-$8FFF and 
  504.          $A000-$AFFF, when set to 1.
  505. $E001    Unknown
  506. ---------------------------------------------------------------------------
  507.  
  508.   In order to use the mapper, you should first write a command number 
  509. into $8000, and then a value (page number) into $8001. Following commands 
  510. exist:
  511.  
  512. Cmd  Function
  513. ---------------------------------------------------------------------------
  514.  0   Select 2 consequent 1kB VROM pages at $0000. The 0th bit of a value
  515.      written into $8001 does not matter, i.e. 5 will always select pages
  516.      4 and 5.
  517.  1   Select 2 consequent 1kB VROM pages at $0800. The 0th bit of a value
  518.      written into $8001 does not matter, i.e. 5 will always select pages
  519.      4 and 5.
  520.  2   Select a 1kB VROM page at $1000.
  521.  3   Select a 1kB VROM page at $1400.
  522.  4   Select a 1kB VROM page at $1800.
  523.  5   Select a 1kB VROM page at $1C00.
  524.  6   Select a 8kB ROM page at $8000. The initial value seems to be 0.
  525.  7   Select a 8kB ROM page at $A000. The initial value seems to be 1.
  526. ---------------------------------------------------------------------------
  527.  
  528.   Note that the ROM pages at $C000 and $E000 are hardwired to the last 
  529. pages of the ROM, and can not be switched (they can be swapped via 
  530. $E000 though).
  531.  
  532.  
  533. 5. Other mappers
  534.  
  535.   There are several other mappers, some of them very sophisticated. iNES
  536. partially supports them, but as this support either doesn't work
  537. correctly, or the mappers are uncommon (such as 100-in-1 cartridge mapper,
  538. I don't cover them here. 
  539.  
  540.  
  541. ******************************** Sound *********************************
  542.  
  543.   To be written.
  544.  
  545.  
  546.  
  547. ---------------------
  548. Marat Fayzullin
  549.